<nz-modal [(nzVisible)]="isVisible" [nzWidth]="modalWidth" (nzOnCancel)="onBack()" [nzStyle]="{'top': '50px'}">
  <div *nzModalTitle>{{ title }}</div>
  <ng-container *nzModalContent>
    <form [formGroup]="repairRequestForm" (keydown.enter)="$event.preventDefault()">
      <nz-row [nzGutter]="10">
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="buildingName" nzRequired>楼栋名称</nz-form-label>
            <nz-form-control [nzErrorTip]="'请选择楼栋名称'">
              <nz-input-group nzSearch [nzAddOnAfter]="buildingNameSuffixIconButton">
                <input nz-input formControlName="buildingName" placeholder="请选择楼栋名称" readonly />
              </nz-input-group>
              <ng-template #buildingNameSuffixIconButton>
                <button nz-button nzType="primary" nzSearch (click)="findBuilding()"><nz-icon nzType="search" /></button>
              </ng-template>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="roomNumber" nzRequired>单元房号</nz-form-label>
            <nz-form-control [nzErrorTip]="'请选择单元房号'">
              <nz-input-group nzSearch [nzAddOnAfter]="roomNumberSuffixIconButton">
                <input nz-input formControlName="roomNumber" placeholder="请选择单元房号" readonly />
              </nz-input-group>
              <ng-template #roomNumberSuffixIconButton>
                <button nz-button nzType="primary" nzSearch (click)="findRoom()"><nz-icon nzType="search" /></button>
              </ng-template>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
      </nz-row>
      <nz-row [nzGutter]="10">
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="description">问题描述</nz-form-label>
            <nz-form-control>
              <input nz-input formControlName="description" placeholder="请输入问题描述" maxlength="65535"/>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="requestTime">报修时间</nz-form-label>
            <nz-form-control >
              <nz-date-picker nzShowTime formControlName="requestTime" nzFormat="yyyy-MM-dd HH:mm:ss"></nz-date-picker>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
      </nz-row>
      <nz-row [nzGutter]="10">
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="status">状态</nz-form-label>
            <nz-form-control>
              <nz-select formControlName="status">
                <nz-option nzLabel="待处理" [nzValue]="10"></nz-option>
                <nz-option nzLabel="处理中" [nzValue]="20"></nz-option>
                <nz-option nzLabel="已完成" [nzValue]="30"></nz-option>
              </nz-select>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="staffName">维修保养人员</nz-form-label>
            <nz-form-control>
              <nz-input-group nzSearch [nzAddOnAfter]="staffNameSuffixIconButton">
                <input nz-input formControlName="staffName" placeholder="请选择维修保养人员" readonly />
              </nz-input-group>
              <ng-template #staffNameSuffixIconButton>
                <button nz-button nzType="primary" nzSearch (click)="findStaff()"><nz-icon nzType="search" /></button>
              </ng-template>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
      </nz-row>
      <nz-row [nzGutter]="10">
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="remark">备注</nz-form-label>
            <nz-form-control>
              <input nz-input formControlName="remark" placeholder="请输入备注" maxlength="255"/>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="finishTime">完成时间</nz-form-label>
            <nz-form-control >
              <nz-date-picker nzShowTime formControlName="finishTime" nzFormat="yyyy-MM-dd HH:mm:ss"></nz-date-picker>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
      </nz-row>
    </form>
  </ng-container>
  <div *nzModalFooter>
    <div class="form-button-container">
      <button nz-button nzType="primary" (click)="onSave()" [nzLoading]="saveLoading">保存</button>
      <button nz-button nzType="default" (click)="onReset()" [nzLoading]="saveLoading">重置</button>
      <button nz-button nzType="default" (click)="onBack()">关闭</button>
    </div>
  </div>
</nz-modal>
<building-selector (buildingSelectedEvent)="handleBuildingSelectedEvent($event)"></building-selector>
<room-selector (roomSelectedEvent)="handleRoomSelectedEvent($event)"></room-selector>
<staff-selector (staffSelectedEvent)="handleStaffSelectedEvent($event)"></staff-selector>
